﻿<?php
class  ViewHelper{
	
	public static function geraLinhasResultado($disciplinas){
		$str = '<tr><th class="colum">Código</th><th>Disciplina</th><th>Turma</th><th>Horário</th></tr>';
		
		$cont = 0;
		foreach($disciplinas as $d){
			$str.= '<tr><td class="colum">'.$d->id.'</td><td>'.$d->nome.'</td><td>'.$d->turma.'</td><td>'.$d->horario.'</td></tr>';
			$cont++;
		}


		if($cont == 0){
			$str .='<td  colspan="4"><i class="icon-warning-sign icon-larger"></i>  Nenhum registro</td>';
		}

		return $str;
	}
	
	public static function geraLinhasDisciplinasSemAcao($disciplinas){
		$str ='<tr><th class="colum">Código</th><th>Disciplina</th></tr>';
		$str .= ViewHelper::geraLinhasDisciplinas($disciplinas);
		return $str;
	}

	public static function geraLinhasDisciplinasComAcao($disciplinas){
		$str ='<tr ><th class="colum">Código</th><th>Disciplina</th><th class="colum">Ação</th></tr>';
		$cont =0;
		foreach($disciplinas as $d){
			$str.= '<tr id="rows_'.$d->id.'"><td>'.$d->id.'</td><td>'.$d->nome.'</td><td><input type="checkbox" class="js-check-disciplina" value="'.$d->id.'"></td></tr>';
			$cont++;
		}

		if($cont == 0){
			$str .='<td  colspan="3"><i class="icon-warning-sign icon-larger"></i>  Nenhum registro</td>';
		}
		return $str;
	}

	public static function geraLinhasDisciplinas($disciplinas){
		
		$str = "";
		$cont = 0;
		foreach($disciplinas as $d){
			$str.= "<tr><td>".$d->id."</td><td>".$d->nome."</td></tr>";
			$cont++;
		}


		if($cont == 0){
			$str .='<td  colspan="3"><i class="icon-warning-sign icon-larger"></i>  Nenhum registro</td>';
		}
		return $str;
	}


	public static function geraLinhaRelatorio($r){
		

			$str = "<tr><td>".$r->dia."</td><td>".$r->mes."</td><td>".$r->ano."</td></tr>";
	
		return $str;
	}


}

?>